// var o;
// exports.PlayerInfo = void 0;
// var $storageClass = require("../../resources/scripts/AL_Framework_Storage_Class");
// var AL_GAME_HUA_i18nMgr = require("./AL_GAME_HUA_i18nMgr");
// var AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_WorldRankConfig = require("./AL_GAME_HUA_WorldRankConfig");
// var AL_GAME_HUA_EmailData = require("./AL_GAME_HUA_EmailData");
// var AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
// var f = {
//     nickName: "",
//     avatarUrl: "",
//     medal: 0,
//     mLevel: 0,
//     avatarIdx: -1,
//     isNewPlayer: !0,
//     newPlayerTimeCore: -1,
//     newPlayerFlag: !1,
//     yesterDayData: {
//         score: -1,
//         rank: -1,
//         timeCore: -1,
//         history: -1
//     },
//     lastWeekData: {
//         score: -1,
//         rank: -1,
//         timeCore: -1,
//         history: -1
//     }
// };
// var d = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t._subScore = 0;
//         t._subMedal = 0;
//         return t;
//     }
//     __extends(t, e);
//     t.getInstance = function () {
//         return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(t);
//     };
//     t.prototype.zhixing_chushihua_chuli = function () {
//         this.chushihua_cunchu_shuju(f);
//         this.chushihua_yuancheng_key(["medal", "mLevel", "yesterDayData", "lastWeekData"]);
//     };
//     t.prototype.huoqu_shifou_wei_xin_yonghu = function () {
//         return (
//             !!this.newPlayerFlag ||
//             (this.isNewPlayer && 1 == AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_guanqia()
//                 ? ((this.newPlayerFlag = !0),
//                   -1 == this.newPlayerTimeCore && (this.newPlayerTimeCore = AL_GAME_HUA_Common.Common.huoqu_dangqian_shijian()),
//                   (this.isNewPlayer = !1),
//                   !0)
//                 : ((this.isNewPlayer = !1), !1))
//         );
//     };
//     t.prototype.huoqu_wanjia_jiben_xinxi = function () {
//         return this.nickName
//             ? {
//                   nickName: this.nickName,
//                   avatarUrl: this.avatarUrl
//               }
//             : null;
//     };
//     t.prototype.ceshihuanjing_shengcheng_wanjia_xinxi = function () {
//         if (AL_GAME_HUA_Common.Common.isDebug()) {
//             var e = AL_GAME_HUA_Common.Common.shengcheng_suiji_zifuchuan(6);
//             window.AL_User_Info.shezhi_open_id(e);
//             this.avatarIdx = Math.get_random_int(1, 14);
//             this.nickName = "玩家_" + e;
//         }
//     };
//     t.prototype.shezhi_wanjia_jiben_xinxi = function (e) {
//         this.nickName = e.nickName;
//         this.avatarUrl = e.avatarUrl;
//     };
//     t.prototype.add_Medal = function (e) {
//         this.medal += e;
//         this.tijiao_jiangpai_dao_shijie_paihangbang();
//     };
//     t.prototype.zengjia_dengji = function (e) {
//         if (void 0 === e) {
//             e = 1;
//         }
//         this.mLevel += e;
//     };
//     t.prototype.huoqu_jintian_dengji = function (e) {
//         return -1 == this.yesterDayData.history
//             ? e || this.mLevel
//             : Math.max(this.mLevel - this.yesterDayData.history, 0);
//     };
//     t.prototype.huoqu_ben_zhou_dengji = function (e) {
//         return -1 == this.lastWeekData.history
//             ? e || this.mLevel
//             : Math.max(this.mLevel - this.lastWeekData.history, 0);
//     };
//     t.prototype.gengxin_zuori_shuju = function (e) {
//         var t;
//         var n = AL_GAME_HUA_Common.Common.huoqu_dangqian_shijian();
//         if (-1 == this.yesterDayData.timeCore || n - this.yesterDayData.timeCore > 864e5) {
//             var o = this.yesterDayData;
//             var i = (o.score, o.timeCore);
//             var r = o.history;
//             null != e.value
//                 ? ((this.yesterDayData.score = null !== (t = e.value) && void 0 !== t ? t : -1),
//                   (this.yesterDayData.history = r && r > 0 ? r + e.value : e.value))
//                 : e.historyData &&
//                   e.historyData.yesterDay &&
//                   ((this.yesterDayData.history = e.historyData.yesterDay),
//                   1 == Math.floor((n - i) / 864e5)
//                       ? (this.yesterDayData.score = r && r > 0 ? e.historyData.yesterDay - r : e.historyData.yesterDay)
//                       : (this.yesterDayData.score = 0));
//             this.yesterDayData.rank = e.rank;
//             var c = new Date(n);
//             c.setHours(0, 0, 0, 0);
//             this.yesterDayData.timeCore = c.getTime();
//             this.shezhi_cunchu_shuju("yesterDayData", this.yesterDayData);
//             if (e.rank > 0 && e.value > 0) {
//                 var p = AL_GAME_HUA_WorldRankConfig.WorldRankConfig.getInstance().huoqu_meiri_jianli_genju_mingci(e.rank);
//                 if (p) {
//                     AL_GAME_HUA_EmailData.EmailData.getInstance().tianjia_youjian({
//                         id: "d" + n,
//                         title: AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian("日排行奖励标题"),
//                         desc: AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian("日排行奖励内容", [e.rank]),
//                         type: 2,
//                         createTime: this.yesterDayData.timeCore,
//                         validTime: 30,
//                         rewards: p.rewardType
//                     });
//                 }
//             }
//         }
//     };
//     t.prototype.gengxin_shangzhou_shuju = function (e) {
//         var t;
//         var n = AL_GAME_HUA_Common.Common.huoqu_dangqian_shijian();
//         if (-1 == this.lastWeekData.timeCore || n - this.lastWeekData.timeCore > 6048e5) {
//             var o = this.lastWeekData;
//             var i = o.timeCore;
//             var r = o.history;
//             null != e.value
//                 ? ((this.lastWeekData.score = null !== (t = e.value) && void 0 !== t ? t : -1),
//                   (this.lastWeekData.history = r && r > 0 ? r + e.value : e.value))
//                 : e.historyData &&
//                   e.historyData.yesterDay &&
//                   ((this.lastWeekData.history = e.historyData.yesterDay),
//                   1 == Math.floor((n - i) / 6048e5)
//                       ? (this.lastWeekData.score = r && r > 0 ? e.historyData.yesterDay - r : e.historyData.yesterDay)
//                       : (this.lastWeekData.score = 0));
//             this.lastWeekData.rank = e.rank;
//             var c = this.huoqu_ben_zhouyi_lingdian_shijian(n);
//             this.lastWeekData.timeCore = c;
//             this.shezhi_cunchu_shuju("lastWeekData", this.lastWeekData);
//             if (e.rank > 0 && e.value > 0) {
//                 var p = AL_GAME_HUA_WorldRankConfig.WorldRankConfig.getInstance().huoqu_meiri_jianli_genju_mingci(e.rank);
//                 if (p) {
//                     AL_GAME_HUA_EmailData.EmailData.getInstance().tianjia_youjian({
//                         id: "w" + n,
//                         title: AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian("周排行奖励标题"),
//                         desc: AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian("周排行奖励内容", [e.rank]),
//                         type: 2,
//                         createTime: this.lastWeekData.timeCore,
//                         validTime: 30,
//                         rewards: p.rewardType
//                     });
//                 }
//             }
//         }
//     };
//     t.prototype.huoqu_ben_zhouyi_lingdian_shijian = function (e) {
//         var t = new Date(e);
//         var n = t.getTime();
//         var o = t.getDay() || 7;
//         var i = new Date(n - 864e5 * (o - 1));
//         i.setHours(0, 0, 0, 0);
//         return i.getTime();
//     };
//     t.prototype.jiancha_shouquan_zhuangtai = function () {
//         var e = this;
//         return this.huoqu_wanjia_jiben_xinxi()
//             ? Promise.resolve(!0)
//             : new Promise(function (t) {
//                   AL_GAME_HUA_Common.Common.getSetting("scope.userInfo")
//                       .then(function (n) {
//                           n.result
//                               ? wx.getUserInfo().then(function (n) {
//                                     e.shezhi_wanjia_jiben_xinxi(n.userInfo);
//                                     t(!0);
//                                 })
//                               : t(!1);
//                       })
//                       .catch(function () {
//                           t(!1);
//                       });
//               });
//     };
//     t.prototype.tijiao_dengji_dao_shijie_paihangbang = function (e) {
//         var t = this;
//         return new Promise(function (n, o) {
//             var i;
//             var r = t.huoqu_wanjia_jiben_xinxi();
//             var a = null != e ? e : t.mLevel;
//             if (r && a > 0 && a != t._subScore) {
//                 ailin_sdk_manager.tijiaoShijiePaihangbangShuju({
//                     nickName: r.nickName,
//                     avatarUrl: r.avatarUrl,
//                     rankContents: ((i = {}), (i.mLevel = a), i),
//                     success: function () {
//                         t._subScore = a;
//                         n();
//                     },
//                     fail: function () {
//                         o();
//                     }
//                 });
//             }
//         });
//     };
//     t.prototype.tijiao_jiangpai_dao_shijie_paihangbang = function (e) {
//         var t = this;
//         return new Promise(function (n, o) {
//             var i;
//             var r = t.huoqu_wanjia_jiben_xinxi();
//             var a = null != e ? e : t.medal;
//             if (r && a > 0 && a != t._subMedal) {
//                 ailin_sdk_manager.tijiaoShijiePaihangbangShuju({
//                     nickName: r.nickName,
//                     avatarUrl: r.avatarUrl,
//                     rankContents: ((i = {}), (i.medal = a), i),
//                     success: function () {
//                         t._subMedal = a;
//                         n();
//                     },
//                     fail: function () {
//                         o();
//                     }
//                 });
//             }
//         });
//     };
//     t.prototype.huoqu_shijie_paihangbang_shuju = function (e) {
//         var t = this;
//         return new Promise(function (n) {
//             ailin_sdk_manager.huoquShijiePaihangbangShuju({
//                 rankID: e,
//                 success: function (o) {
//                     if (o) {
//                         var i = o.userInfo;
//                         var r = o.rankList;
//                         if (i.historyData) {
//                             i.historyData = JSON.parse(i.historyData);
//                         }
//                         e == AL_GAME_HUA_Define.Define.RANK_ID.YESTERDAY
//                             ? (t.gengxin_zuori_shuju(i),
//                               console.log("昨日数据", t.yesterDayData),
//                               (i.value = t.yesterDayData.score),
//                               (i.rank = t.yesterDayData.rank))
//                             : e == AL_GAME_HUA_Define.Define.RANK_ID.LASTWEEK
//                             ? (t.gengxin_shangzhou_shuju(i),
//                               console.log("上周数据", t.lastWeekData),
//                               (i.value = t.lastWeekData.score),
//                               (i.rank = t.lastWeekData.rank))
//                             : e == AL_GAME_HUA_Define.Define.RANK_ID.TODAY
//                             ? (i.value = t.huoqu_jintian_dengji(i.value))
//                             : e == AL_GAME_HUA_Define.Define.RANK_ID.WEEKLY
//                             ? (i.value = t.huoqu_ben_zhou_dengji(i.value))
//                             : e == AL_GAME_HUA_Define.Define.RANK_ID.MEDAL && (i.value = t.medal);
//                         r = r.filter(function (e) {
//                             return e.value > 0;
//                         });
//                         o.rankList = r;
//                     }
//                     n(o);
//                 },
//                 fail: function (t) {
//                     console.warn("拉取榜数据失败", e, t);
//                     n(null);
//                 }
//             });
//         });
//     };
//     t.bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
//     t.key = "_pi";
//     return t;
// })($storageClass.AL_Framework_Storage_Class);
// exports.PlayerInfo = d;


let externalModule;
exports.PlayerInfo = void 0;

const AL_Framework_Storage_Class = require("../../resources/scripts/AL_Framework_Storage_Class");
const I18nManager = require("./AL_GAME_HUA_i18nMgr");
const CommonModule = require("./AL_GAME_HUA_Common");
const DefineModule = require("./AL_GAME_HUA_Define");
const WorldRankConfig = require("./AL_GAME_HUA_WorldRankConfig");
const EmailDataModule = require("./AL_GAME_HUA_EmailData");
const GameDataModule = require("./AL_GAME_HUA_GameData");

// 玩家初始信息
const defaultPlayerInfo = {
    nickName: "",
    avatarUrl: "",
    medal: 0,
    mLevel: 0,
    avatarIdx: -1,
    isNewPlayer: true,
    newPlayerTimeCore: -1,
    newPlayerFlag: false,
    yesterDayData: {
        score: -1,
        rank: -1,
        timeCore: -1,
        history: -1
    },
    lastWeekData: {
        score: -1,
        rank: -1,
        timeCore: -1,
        history: -1
    }
};

// PlayerInfo 继承自 AL_Framework_Storage_Class
class PlayerInfo extends AL_Framework_Storage_Class.AL_Framework_Storage_Class {

    constructor() {
        super();
        // 玩家分数提交至排行榜后的缓存值
        this._subScore = 0;
        this._subMedal = 0;
    }

    /**
     * 获取单例实例
     * @returns {PlayerInfo} PlayerInfo的单例实例
     */
    static getInstance() {
        return AL_APP_SDK_MANAGER.localManager.huoqu_cunchu_lei(this);
    }

    /**
     * 初始化方法，初始化存储和远程键
     */
    zhixing_chushihua_chuli() {
        this.chushihua_cunchu_shuju(defaultPlayerInfo);
        this.chushihua_yuancheng_key(["medal", "mLevel", "yesterDayData", "lastWeekData"]);
    }

    /**
     * 获取是否为新玩家的标识
     * @returns {boolean} 是否为新玩家
     */
    huoqu_shifou_wei_xin_yonghu() {
        const gameData = GameDataModule.GameData.getInstance();
        if (this.newPlayerFlag || (this.isNewPlayer && gameData.huoqu_yijiesuo_guanqia() === 1)) {
            if (this.newPlayerTimeCore === -1) {
                this.newPlayerTimeCore = CommonModule.Common.huoqu_dangqian_shijian();
            }
            this.isNewPlayer = false;
            this.newPlayerFlag = true;
            return true;
        }
        this.isNewPlayer = false;
        return false;
    }

    /**
     * 获取玩家基本信息
     * @returns {Object|null} 玩家信息对象或null
     */
    huoqu_wanjia_jiben_xinxi() {
        return this.nickName ? { nickName: this.nickName, avatarUrl: this.avatarUrl } : null;
    }

    /**
     * 测试环境下生成随机玩家信息
     */
    ceshihuanjing_shengcheng_wanjia_xinxi() {
        if (CommonModule.Common.isDebug()) {
            const randomStr = CommonModule.Common.shengcheng_suiji_zifuchuan(6);
            window.AL_User_Info.shezhi_open_id(randomStr);
            this.avatarIdx = Math.get_random_int(1, 14);
            this.nickName = `玩家_${randomStr}`;
        }
    }

    /**
     * 设置玩家信息
     * @param {Object} info - 包含nickName和avatarUrl的对象
     */
    shezhi_wanjia_jiben_xinxi(info) {
        this.nickName = info.nickName;
        this.avatarUrl = info.avatarUrl;
    }

    /**
     * 增加奖牌数量，并提交到排行榜
     * @param {number} medal - 增加的奖牌数量
     */
    add_Medal(medal) {
        this.medal += medal;
        this.tijiao_jiangpai_dao_shijie_paihangbang();
    }

    /**
     * 增加玩家等级
     * @param {number} level - 增加的等级数量，默认为1
     */
    zengjia_dengji(level = 1) {
        this.mLevel += level;
    }

    /**
     * 获取当天等级
     * @param {number} level 
     * @returns {number} 今日等级
     */
    huoqu_jintian_dengji(level) {
        return this.yesterDayData.history === -1
            ? (level || this.mLevel)
            : Math.max(this.mLevel - this.yesterDayData.history, 0);
    }

    /**
     * 获取本周等级
     * @param {number} level
     * @returns {number} 本周等级
     */
    huoqu_ben_zhou_dengji(level) {
        return this.lastWeekData.history === -1
            ? (level || this.mLevel)
            : Math.max(this.mLevel - this.lastWeekData.history, 0);
    }

    /**
     * 更新昨日数据
     * @param {Object} data - 更新数据对象
     */
    gengxin_zuori_shuju(data) {
        const now = CommonModule.Common.huoqu_dangqian_shijian();
        if (this.yesterDayData.timeCore === -1 || now - this.yesterDayData.timeCore > 86400000) {
            const historyData = this.yesterDayData.history;

            if (data.value != null) {
                this.yesterDayData.score = data.value ?? -1;
                this.yesterDayData.history = (historyData && historyData > 0) ? (historyData + data.value) : data.value;
            } else if (data.historyData && data.historyData.yesterDay) {
                this.yesterDayData.history = data.historyData.yesterDay;
                if (Math.floor((now - this.yesterDayData.timeCore) / 86400000) === 1) {
                    this.yesterDayData.score = (historyData && historyData > 0) ? (data.historyData.yesterDay - historyData) : data.historyData.yesterDay;
                } else {
                    this.yesterDayData.score = 0;
                }
            }

            this.yesterDayData.rank = data.rank;
            const resetTime = new Date(now);
            resetTime.setHours(0, 0, 0, 0);
            this.yesterDayData.timeCore = resetTime.getTime();
            this.shezhi_cunchu_shuju("yesterDayData", this.yesterDayData);

            if (data.rank > 0 && data.value > 0) {
                const rewardConfig = WorldRankConfig.WorldRankConfig.getInstance().huoqu_meiri_jianli_genju_mingci(data.rank);
                if (rewardConfig) {
                    EmailDataModule.EmailData.getInstance().tianjia_youjian({
                        id: `d${now}`,
                        title: I18nManager.i18nMgr._huoqu_biaoqian("日排行奖励标题"),
                        desc: I18nManager.i18nMgr._huoqu_biaoqian("日排行奖励内容", [data.rank]),
                        type: 2,
                        createTime: this.yesterDayData.timeCore,
                        validTime: 30,
                        rewards: rewardConfig.rewardType
                    });
                }
            }
        }
    }

    /**
     * 更新上周数据
     * @param {Object} data - 更新数据对象
     */
    gengxin_shangzhou_shuju(data) {
        const now = CommonModule.Common.huoqu_dangqian_shijian();
        if (this.lastWeekData.timeCore === -1 || now - this.lastWeekData.timeCore > 604800000) {
            const historyData = this.lastWeekData.history;

            if (data.value != null) {
                this.lastWeekData.score = data.value ?? -1;
                this.lastWeekData.history = (historyData && historyData > 0) ? (historyData + data.value) : data.value;
            } else if (data.historyData && data.historyData.yesterDay) {
                this.lastWeekData.history = data.historyData.yesterDay;
                if (Math.floor((now - this.lastWeekData.timeCore) / 604800000) === 1) {
                    this.lastWeekData.score = (historyData && historyData > 0) ? (data.historyData.yesterDay - historyData) : data.historyData.yesterDay;
                } else {
                    this.lastWeekData.score = 0;
                }
            }

            this.lastWeekData.rank = data.rank;
            const weeklyResetTime = this.huoqu_ben_zhouyi_lingdian_shijian(now);
            this.lastWeekData.timeCore = weeklyResetTime;
            this.shezhi_cunchu_shuju("lastWeekData", this.lastWeekData);

            if (data.rank > 0 && data.value > 0) {
                const rewardConfig = WorldRankConfig.WorldRankConfig.getInstance().huoqu_meiri_jianli_genju_mingci(data.rank);
                if (rewardConfig) {
                    EmailDataModule.EmailData.getInstance().tianjia_youjian({
                        id: `w${now}`,
                        title: I18nManager.i18nMgr._huoqu_biaoqian("周排行奖励标题"),
                        desc: I18nManager.i18nMgr._huoqu_biaoqian("周排行奖励内容", [data.rank]),
                        type: 2,
                        createTime: this.lastWeekData.timeCore,
                        validTime: 30,
                        rewards: rewardConfig.rewardType
                    });
                }
            }
        }
    }

    /**
     * 获取本周一零点的时间
     * @param {number} currentTime - 当前时间戳
     * @returns {number} 本周一零点时间戳
     */
    huoqu_ben_zhouyi_lingdian_shijian(currentTime) {
        const date = new Date(currentTime);
        const currentDay = date.getDay() || 7; // 若为周日则设为7
        const monday = new Date(currentTime - 86400000 * (currentDay - 1));
        monday.setHours(0, 0, 0, 0);
        return monday.getTime();
    }

    /**
     * 检查授权状态
     * @returns {Promise<boolean>} 是否已授权
     */
    jiancha_shouquan_zhuangtai() {
        const self = this;
        return this.huoqu_wanjia_jiben_xinxi()
            ? Promise.resolve(true)
            : new Promise(resolve => {
                    CommonModule.Common.getSetting("scope.userInfo")
                        .then(settingResult => {
                            if (settingResult.result) {
                                wx.getUserInfo().then(userInfo => {
                                    self.shezhi_wanjia_jiben_xinxi(userInfo.userInfo);
                                    resolve(true);
                                });
                            } else {
                                resolve(false);
                            }
                        })
                        .catch(() => {
                            resolve(false);
                        });
                });
    }

    /**
     * 提交等级到世界排行榜
     * @param {number} level - 提交的等级数据
     * @returns {Promise<void>} 提交结果
     */
    tijiao_dengji_dao_shijie_paihangbang(level) {
        return Promise.resolve();
        // const self = this;
        // return new Promise((resolve, reject) => {
        //     const playerInfo = self.huoqu_wanjia_jiben_xinxi();
        //     const currentLevel = level != null ? level : self.mLevel;
        //     if (playerInfo && currentLevel > 0 && currentLevel !== self._subScore) {
        //         ailin_sdk_manager.tijiaoShijiePaihangbangShuju({
        //             nickName: playerInfo.nickName,
        //             avatarUrl: playerInfo.avatarUrl,
        //             rankContents: { mLevel: currentLevel },
        //             success: () => {
        //                 self._subScore = currentLevel;
        //                 resolve();
        //             },
        //             fail: reject
        //         });
        //     }
        // });
    }

    /**
     * 提交奖牌到世界排行榜
     * @param {number} medal - 提交的奖牌数据
     * @returns {Promise<void>} 提交结果
     */
    tijiao_jiangpai_dao_shijie_paihangbang(medal) {
        return Promise.resolve();
        // const self = this;
        // return new Promise((resolve, reject) => {
        //     const playerInfo = self.huoqu_wanjia_jiben_xinxi();
        //     const currentMedal = medal != null ? medal : self.medal;
        //     if (playerInfo && currentMedal > 0 && currentMedal !== self._subMedal) {
        //         ailin_sdk_manager.tijiaoShijiePaihangbangShuju({
        //             nickName: playerInfo.nickName,
        //             avatarUrl: playerInfo.avatarUrl,
        //             rankContents: { medal: currentMedal },
        //             success: () => {
        //                 self._subMedal = currentMedal;
        //                 resolve();
        //             },
        //             fail: reject
        //         });
        //     }
        // });
    }

    /**
     * 获取世界排行榜数据
     * @param {string} rankID - 排行榜ID
     * @returns {Promise<Object|null>} 排行榜数据或null
     */
    huoqu_shijie_paihangbang_shuju(rankID) {
        const self = this;
        return new Promise(resolve => {
            ailin_sdk_manager.huoquShijiePaihangbangShuju({
                rankID,
                success: (rankData) => {
                    if (rankData) {
                        const userInfo = rankData.userInfo;
                        let rankList = rankData.rankList;
                        if (userInfo.historyData) {
                            userInfo.historyData = JSON.parse(userInfo.historyData);
                        }

                        switch (rankID) {
                            case DefineModule.Define.RANK_ID.YESTERDAY:
                                self.gengxin_zuori_shuju(userInfo);
                                console.log("昨日数据", self.yesterDayData);
                                userInfo.value = self.yesterDayData.score;
                                userInfo.rank = self.yesterDayData.rank;
                                break;
                            case DefineModule.Define.RANK_ID.LASTWEEK:
                                self.gengxin_shangzhou_shuju(userInfo);
                                console.log("上周数据", self.lastWeekData);
                                userInfo.value = self.lastWeekData.score;
                                userInfo.rank = self.lastWeekData.rank;
                                break;
                            case DefineModule.Define.RANK_ID.TODAY:
                                userInfo.value = self.huoqu_jintian_dengji(userInfo.value);
                                break;
                            case DefineModule.Define.RANK_ID.WEEKLY:
                                userInfo.value = self.huoqu_ben_zhou_dengji(userInfo.value);
                                break;
                            case DefineModule.Define.RANK_ID.MEDAL:
                                userInfo.value = self.medal;
                                break;
                            default:
                                break;
                        }

                        rankList = rankList.filter(item => item.value > 0);
                        rankData.rankList = rankList;
                    }
                    resolve(rankData);
                },
                fail: () => {
                    console.warn("拉取榜数据失败", rankID);
                    resolve(null);
                }
            });
        });
    }
}

PlayerInfo.bundle = DefineModule.Define.GAME_NAME;
PlayerInfo.key = "_pi";

exports.PlayerInfo = PlayerInfo;